/**
 * 商品方法显示
 */

import React from 'react'
import { View } from '@tarojs/components'
import { DesktopOrderType } from '@/utils/constants';
import { Popup } from '../Popup'
import { ButtonEle, ButtonType } from '../Buttton'
import './index.scss'


export interface BaseProps {
    vis: boolean
    onClose: () => void
    setOrder: (string) => void
    scanCode: () => void
}
export const OrderType: React.FC<BaseProps> = (
    prop
) => {

    return (
        <Popup
            visible={prop.vis}
            position="center"
            round
            onClose={prop.onClose}
            closeable
            closeOnClickOverlay
            customStyle={{
            }}
        >
            <View className="xxm-type">
                <View className="xxm-type__header">
                    -- 选择就餐方式 --
                </View>
                <View className="xxm-type__content">
                    <ButtonEle
                        type={ButtonType.DANGE}
                        block
                        customClass="type-btn"
                        onClick={() => {
                            // prop.setOrder(INSTORE);
                            prop.scanCode();
                        }}
                    >堂食</ButtonEle>
                    <ButtonEle
                        type={ButtonType.DANGE}
                        block
                        customClass="type-btn"
                        onClick={() => {
                            prop.setOrder(DesktopOrderType[1])
                        }}
                    >外卖</ButtonEle>
                    <ButtonEle
                        type={ButtonType.DANGE}
                        block
                        customClass="type-btn"
                        onClick={() => {
                            prop.setOrder(DesktopOrderType[2])
                        }}
                    >自提</ButtonEle>
                </View>
            </View>

        </Popup>
    )
}